package gui;

import java.util.ArrayList;
import java.util.LinkedList;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;

public class MenuContext
{
	public static void main(String[] args) {

	    Display display = new Display();

	    Shell shell = new Shell(display);

	    List list = new List(shell, SWT.BORDER | SWT.V_SCROLL);
	    list.setItems(new String [] {"A", "B", "C", "D"});

	    list.setSize(200, 200);

	    Menu menu = new Menu(shell, SWT.POP_UP);
	    for (int i=0; i<8; i++) {
	          MenuItem item = new MenuItem(menu, SWT.PUSH);
	          item.setText("Item " + i);

	    }

	    list.setMenu(menu);

	    shell.pack();

	    shell.open();

	    while (!shell.isDisposed()) {

	        if (!display.readAndDispatch()) display.sleep();

	    }

	    display.dispose();

	}

}
